﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using MM.Common.Base;

namespace MM.Common.UI.Controls
{
    public class UCFunctionPoint : Component, IControlProperty
    {
        // Fields
        private string _ControlCode;
        private string _ControlName;
        private EControlPropertyStatus _ControlProperty;
        private IContainer components;

        // Methods
        public UCFunctionPoint()
        {
            this.InitializeComponent();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            this.components = new Container();
        }

        // Properties
        [Description("控制本控件对应的系统代码"), Browsable(true), DefaultValue((string)null), Category("MM附加")]
        public string ControlCode
        {
            get
            {
                return this._ControlCode;
            }
            set
            {
                this._ControlCode = value;
            }
        }

        [Description("控制本控件对应的系统名称"), Category("MM附加"), Browsable(true), DefaultValue((string)null)]
        public string ControlName
        {
            get
            {
                return this._ControlName;
            }
            set
            {
                this._ControlName = value;
                if ((!base.DesignMode && !string.IsNullOrEmpty(this.ControlCode)) && (this._ControlProperty == EControlPropertyStatus.None))
                {
                    this._ControlProperty = BaseDataHelper.GetFunctionPointProperty(this._ControlCode, this._ControlName);
                }
            }
        }

        [DefaultValue(0), Browsable(false)]
        public EControlPropertyStatus ControlProperty
        {
            get
            {
                return this._ControlProperty;
            }
        }
    }
}
